using System;
using System.Collections.Generic;
using System.Text;
using CUtil.Excel;
using NUnit.Framework;
using CStock;
using TestCases.StockData;
using System.Data;


namespace TestCases.Excel
{
    [TestFixture]
    public class BasicExcelTest : ProgramContext_TestCases
    {
        ExcelWriter excelWriter;
        CStock.ExcelReader excelReader;
        
        public BasicExcelTest()
		{
            excelWriter = new ExcelWriter();
            excelReader = new ExcelReader();
           
            
        }

        public void WriteDataTableInExcel()
        {
          
            DataTable statusReport = new DataTable("StatusReport");

            statusReport.Columns.Add("Index");
            statusReport.Columns.Add("Date");
            




            DataRow dr = statusReport.NewRow();
            dr[0] = "1";
            dr[1] = "12.12.12";
           
            statusReport.Rows.Add(dr);
            //---------------------------------
            excelWriter.CreateFile(this.programContext.Path + @"\test.xml");
            excelWriter.GenerateWorksheet(statusReport, "Test");
            excelWriter.CloseFile();



        }
        [Test]
        public void WriteExcel()
        {
            string excelFileName = this.programContext.Path + @"\A_Simulation_01.xls";
            if (excelReader.ReadExcelFile_SetDataSet(excelFileName))
            {
                DataTable dataTable = excelReader.DataSetExcel.Tables[0];
                excelWriter.CreateFile(this.programContext.Path + @"\REsult.xml");
                excelWriter.GenerateWorksheet(dataTable, "Test");
                excelWriter.CloseFile();
            }

        }

    }
}
